﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace dpdw.CompoundPattern
{
    /// <summary>
    /// 鸭群 组合模式和迭代器模式
    /// </summary>
    public class Flock : IQuackable
    {
        ArrayList quackers = new ArrayList();

        public void Add(IQuackable quacker)
        {
            quackers.Add(quacker);
        }

        public void Quack()
        {
            foreach (IQuackable quacker in quackers)
            {
                quacker.Quack();
            }
        }
    }
}
